<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>

<footer class="ui-footer ui-footer-btn" style="height:50px;">
	<ul class="ui-tiled ui-border-t">
		<li data-href="index.html" class="ui-border-r">
			<div>
				<a id="question" class="" href="./index">问题</a>
			</div>
		</li>
		<li data-href="ui.html" class="ui-border-r ">
			<div id="askquestion" class="">
				+ 我要提问
			</div>
		</li>
		<li data-href="user_center.html">
			<div>
				<a id="usercenter" href="./usercenter">个人中心</a>
			</div>
		</li>
	</ul>
	<!-- 提问框begin -->
	<div class="ui-dialog">
		<div class="ui-dialog-cnt" style="width: 83%;">
			<header class="ui-dialog-hd ui-border-b">
				<h3>提问</h3>
			</header>
			<div style="text-align: center; margin-bottom: -7px;">
				<textarea id="newquestion" style="width: 99%; height: 150px; border: none;" placeholder="&nbsp;输入你的问题..."></textarea>
			</div>
			<div class="ui-dialog-ft">
				<button type="button" data-role="button">取消</button>
				<button id="confirmquestion" type="button" data-role="button">提交问题</button>
			</div>
		</div>
	</div>
	<!-- 提问框end -->
	
	<script type="text/javascript">
		$(function() {
			var thisURL = document.URL;
			if(thisURL.match("index")) {
				$("#question").css("font-weight","bold");
			}
			if(thisURL.match("usercenter")) {
				$("#usercenter").css("font-weight","bold");
			}
			if(thisURL.match("detail")) {
				$(".ui-tiled").hide();
			}
			
		})
	
		// 提交问题
		$("#askquestion").tap(function(){
			$(".ui-dialog").dialog("show");
		});
		$("#confirmquestion").tap(function(){
			var newquestion =  replaceEmoji($("#newquestion").val());
				if (newquestion) {
						$.ajax({
							url : "${ctx}/wechat/faq/question/add",
							type : 'post',
							dataType : 'json',
							data : {
								"questtionContent" : newquestion
							},
							success : function(result) {
								if (result.code == 1) {
									alert(result.msg);
									location.reload();
								} else {
									alert("");
								}
							}
						})
				} else {
					alert("请输入你的问题");
				}
		});
	</script>
</footer>
